package com.spzx.channel.service.impl;

import com.spzx.channel.service.ICategoryService;
import com.spzx.common.core.constant.SecurityConstants;
import com.spzx.common.core.domain.R;
import com.spzx.product.api.RemoteCategoryService;
import com.spzx.product.api.domain.vo.CategoryTreeVo;
import com.spzx.product.api.domain.vo.CategoryVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * ClassName: CategoryServiceImpl
 * Package: com.spzx.channel.service.impl
 * Description:
 */
@Slf4j
@Service
public class CategoryServiceImpl implements ICategoryService {
    @Autowired
    private RemoteCategoryService remoteCategoryService;
    @Override
    public List<CategoryTreeVo> getCategoryTree() {
        R<List<CategoryTreeVo>> categoryVoTreeResult = remoteCategoryService.getCategoryTree(SecurityConstants.INNER);
        if (R.FAIL==categoryVoTreeResult.getCode()){
            log.error("调用商品服务失败:{}",categoryVoTreeResult.getMsg());
        }
        return categoryVoTreeResult.getData();
    }
}
